package exercises;

import java.util.Scanner;

/**
 * @author zerorain
 **/
public class ex3{
    public static void reverse(char[] c,int i ,int j){
        while (i<j){
            char temp = c[i];
            c[i] = c[j];
            c[j] = temp;
            i++;
            j--;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        //首先去掉两边的空格
        str.trim();
        char[] arr = str.toCharArray();
        reverse(arr,0,arr.length-1);
        int tep = 0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == ' '){
                reverse(arr,tep,i-1);
                tep = i+1;
            }
        }
        reverse(arr,tep,arr.length-1);
        System.out.println(arr);


    }
}